Skip to content

fix(build): support absolute DerivedData paths with xcodemake#485

Merged
cameroncooke merged 7 commits into
mainfrom
codex/fix-xcodemake-log-path
Jul 22, 2026
Merged

fix(build): support absolute DerivedData paths with xcodemake#485
cameroncooke merged 7 commits into
mainfrom
codex/fix-xcodemake-log-path

Conversation

@cameroncooke

@cameroncooke cameroncooke commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Problem

xcodemake is XcodeBuildMCP's optional incremental-build accelerator. On its first run it captures an xcodebuild invocation and generates a Makefile; later runs can reuse that Makefile to avoid the startup cost of another full Xcode build.

When XcodeBuildMCP passed an absolute DerivedData path such as /Users/.../DerivedData, the bundled wrapper included the raw build arguments in its capture-log filename. The slashes were treated as directory separators, so the log could not be created and the build failed before a Makefile was generated.

XcodeBuildMCP also tried to decide for itself whether an existing Makefile was safe to reuse. That check depended on the wrapper's old log naming scheme and could select the project's single Makefile even when it had been generated for different build arguments.

Fix

This PR updates the checksum-pinned xcodemake wrapper to a repaired revision that converts the build arguments into a bounded, filesystem-safe log name with an argument hash to prevent collisions.

Every incremental build now goes through the wrapper. The wrapper owns the decision to reuse or regenerate the Makefile based on the exact build arguments and whether the project has changed. Calls without an explicit project or workspace path use the current working directory, so xcodemake always receives a valid working directory and absolute arguments keep their leading slash.

Standard builds that do not use xcodemake are unchanged. The inherited Git configuration and doctor command concerns also mentioned in the issue are separate problems and remain outside this PR.

Regression protection

The regression test executes an exact, checksum-verified copy of the production-pinned Perl wrapper against isolated fake xcodebuild and make executables. It verifies that:

  • an external absolute DerivedData path can be captured successfully;
  • an identical build reuses the Makefile without recapturing;
  • changed build arguments or a newer project force a fresh capture;
  • -configuration is preserved during capture and direct-build fallback;
  • a failed make invocation follows the wrapper's direct xcodebuild recovery path; and
  • scheme-only calls use a non-empty working directory without altering absolute paths.

The focused coverage and full unit suite pass with 2,896 tests, together with type checking, the production build, formatting, and linting. Snapshot and smoke suites were not run because repository policy requires separate approval.

Fixes #466.

Update the pinned xcodemake revision so absolute DerivedData paths produce safe capture log filenames. Match the new logs by their argument hash before deciding whether to run make directly.

Fixes #466
Always invoke the pinned wrapper so it owns Makefile argument and freshness validation before delegating to make.

Refs #466
Execute the checksum-verified pinned wrapper with fake build tools and verify capture, reuse, argument invalidation, and project freshness behavior.

Refs #466
Copilot AI review requested due to automatic review settings July 21, 2026 18:26
@pkg-pr-new

pkg-pr-new Bot commented Jul 21, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/xcodebuildmcp@485

commit: c3d0536

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates XcodeBuildMCP’s incremental-build path to always invoke the pinned xcodemake wrapper (instead of locally deciding when to run make), and refreshes the pinned wrapper commit/checksum to address failures when -derivedDataPath is an absolute external path.

Changes:

  • Updated the pinned xcodemake commit + SHA-256, and added a checksum-verified fixture plus a wrapper lifecycle regression test.
  • Simplified incremental build execution to always route through xcodemake, delegating Makefile reuse / invalidation decisions to the wrapper.
  • Added unit coverage ensuring executeXcodeBuildCommand delegates to xcodemake (via mocking) for external absolute DerivedData paths, and recorded the fix in the changelog.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/utils/xcodemake.ts Updates the pinned xcodemake commit/checksum and keeps download + integrity verification flow.
src/utils/build-utils.ts Removes local Makefile/log heuristics and always runs xcodemake for incremental builds.
src/utils/tests/xcodemake.test.ts Drops coverage for removed local log-file detection helper.
src/utils/tests/xcodemake-wrapper.test.ts Adds an execution-based regression test for the pinned wrapper behavior using hermetic fake build tools.
src/utils/tests/fixtures/xcodemake/xcodemake-7d20… Adds the exact pinned wrapper script as a fixture for checksum-verified regression execution.
src/utils/tests/fixtures/xcodemake/README.md Documents fixture pinning and checksum requirements.
src/utils/tests/build-utils-xcodemake.test.ts Adds a focused unit test verifying build-utils always delegates incremental builds to xcodemake.
CHANGELOG.md Adds an Unreleased entry for the incremental xcodemake absolute DerivedData fix (Issue #466).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Repin the bundled wrapper to the upstream lifecycle fixes and add regression coverage for long configuration arguments, direct fallback, and Makefile reuse.
Copilot AI review requested due to automatic review settings July 21, 2026 18:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comment thread src/utils/__tests__/xcodemake-wrapper.test.ts
Keep the wrapper lifecycle test independent of the process working directory.
Copilot AI review requested due to automatic review settings July 21, 2026 19:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comment thread src/utils/__tests__/xcodemake-wrapper.test.ts Outdated
Compare the observed Makefile timestamp with the explicit sentinel using a filesystem-resolution tolerance.
Copilot AI review requested due to automatic review settings July 21, 2026 19:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comment thread src/utils/build-utils.ts
@cameroncooke
cameroncooke marked this pull request as ready for review July 22, 2026 08:35
Copilot AI review requested due to automatic review settings July 22, 2026 08:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

@cameroncooke cameroncooke changed the title fix(build): Delegate incremental state to xcodemake fix(build): support absolute DerivedData paths with xcodemake Jul 22, 2026
@cameroncooke
cameroncooke merged commit 931b57a into main Jul 22, 2026
22 checks passed
@cameroncooke
cameroncooke deleted the codex/fix-xcodemake-log-path branch July 22, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]:  xcodemake incremental builds fails

2 participants